Out[7]:

<Axes: xlabel='alcohol', ylabel='total'>


In [ ]:

Inference: The scatterplot helps visualize the relationship between alcohol involvement and total crashes.


  1. Histplot

    In [8]:

    sns.histplot(x="total",bins=20, kde=True,data=df) Out[8]:

    <Axes: xlabel='total', ylabel='Count'>

    In [ ]:

    Inference:The histplot allows you to draw the following inferences about the distribution of total crashes


  2. Boxplot

In [9]:

sns.boxplot(df) Out[9]:

>

<Axes:


In [ ]:

Inference: This boxplot helps visualize the relationship between all columns and their p rices.


.

  1. Countplot

    In [10]:

    sns.countplot(x="abbrev",data=df) Out[10]:

    <Axes: xlabel='abbrev', ylabel='count'>


    In [ ]:

    Inference:In this countplot we can see that relation between states and count of crashes occured in each state.


    .

  2. Jointplot

In [11]:

sns.jointplot(x="alcohol",y="speeding",data=df) Out[11]:

90>

<seaborn.axisgrid.JointGrid at 0x233c8e8dd



In [ ]:

Inference:The joint plot above displays the relationship between the "alcohol" and "speed ing" variables.

  1. Relplot

    In [12]:

    sns.relplot(x="alcohol",y="speeding",data=df,height=6,hue="speeding") Out[12]:

    <seaborn.axisgrid.FacetGrid at 0x233c922edd0>



    In [ ]:

    Inference:The relplot allows us to visually assess the relationship between alcohol invo lvement and speeding involvement in car crashes


  2. Lineplot

    In [13]:

    sns.lineplot(x="abbrev",y="total",data=df,marker="o") Out[13]:

    <Axes: xlabel='abbrev', ylabel='total'>


    In [ ]:

    Inference:The plot visualizes how the total number of crashes varies from one state to a nother state.


  3. Barplot

    In [14]:

    >

    sns.barplot(x="abbrev",y="total",data=df) Out[14]:

    <Axes: xlabel='abbrev', ylabel='total'


    In [ ]:

    Inference:The bar plot shows the average total crashes by state.


  4. Heatmap

In [22]:

corr=df.corr() corr

C:\Users\murra\AppData\Local\Temp\ipykernel_27992\1661191605.py:1: FutureWarning: The def ault value of numeric_only in DataFrame.corr is deprecated. In a future version, it will default to False. Select only valid columns or specify the value of numeric_only to silen ce this warning.

corr=df.corr() Out[22]:


total

speeding

alcohol

not_distracted

no_previous

ins_pre iu

ins_losses

total speeding alcohol not_distracted no_previous ins_premium ins_losses


total

total 1.000000 0.611548 0.852613 0.827560 0.956179 -0.199702 -0.036011


speeding

speeding 0.611548 1.000000 0.669719 0.588010 0.571976 -0.077675 -0.065928


alcohol

alcohol 0.852613 0.669719 1.000000 0.732816 0.783520 -0.170612 -0.112547


not_distracted

not_distracted 0.827560 0.588010 0.732816 1.000000 0.747307 -0.174856 -0.075970


no_previous

no_previous 0.956179 0.571976 0.783520 0.747307 1.000000 -0.156895 -0.006359


ins_pre iu

ins_premium -0.199702 -0.077675 -0.170612 -0.174856 -0.156895 1.000000 0.623116


ins_losses

ins_losses -0.036011 -0.065928 -0.112547 -0.075970 -0.006359 0.623116 1.000000


In [23]:

sns.heatmap(corr,annot=True) Out[23]:

>

<Axes:


In [ ]:

Inference:

  1. Darker colors indicate stronger correlations, while lighter colors indicate weaker or no correlations.

  2. The diagonal of the heatmap is always 1 because it represents the correlation of a va riable with itself (perfect correlation).

In [ ]:

In [ ]:

In [ ]: